<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div>
    <div v-if="!isLove">
        <a href="javascript:void(0)">注册</a>
        <a href="javascript:void(0)" @click="isLove=true">登录</a>
    </div>
    <div v-else>
        <input type="text" placeholder="名字" v-model="name">
        <a href="javascript:void(0)"@click="f()">添加</a>
        <a href="javascript:void(0)" @click="isLove=false">登出</a>
    </div>
    <ul>
        <li v-for="a in arr">{{a}}</li>
    </ul>
</div>
<script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
<script>
    let v = new Vue({
        el:"body>div",
        data:{
            isLove:false,
            name:"",
            arr:["张飞","赵云"]
        },
        methods:{
            f:function () {
                v.arr.push(v.name);
            }
        }
    })
</script>
</body>
</html>